package com.bwie.controller;

import com.bwie.pojo.Brand;
import com.bwie.service.BrandService;

import com.bwie.utils.R;
import com.bwie.vo.BrandVo;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;
import javax.annotation.Resource;
import java.util.List;

/**
 * @author : LeiMingkun
 * @date : 2024-08-15 16:22
 * @description : BrandController
 **/
@RestController
@RequestMapping("/brand/brand")
public class BrandController {
    @Resource
    private BrandService brandService;

    @RequestMapping("/batchDel")
    public R batchDel(@RequestBody List<Integer> brandList){
//        return brandService.batchDel(brandList);
        return brandService.batchDel(brandList);
    }

    @RequestMapping("/brandList")
    public R brandList(@RequestBody BrandVo brandVo){
        return brandService.brandList(brandVo);
    }

    /**
      * @Param: [id]
      * @Return: com.bwie.utils.R
      * @Author: LeiMingkun
      * @Date: 2024/8/15 21:21
     */
    @DeleteMapping("/deleteById/{id}")
    public R removes(@PathVariable(name = "id") Integer id){

        brandService.removeById(id);

        return R.success();

    }

    @PostMapping("/updatesByid")
    public R updatesByid(@RequestBody BrandVo brandVo){
        return brandService.updatesByid(brandVo);
    }

    @RequestMapping("/insertBrand")
    public R insertBrand(@RequestBody BrandVo brandVo){
        return brandService.insertBrand(brandVo);
    }


}